﻿@using System.Text
@using OA.Model
@using OA.AspNetCore.Html
@using OA.Core.Model
@using OA.Core.Helper

@model PageList<SimpleKnowledge>
@{
    ViewBag.Title = "产品列表";
    Layout = "~/Areas/Member/Views/Shared/_Layout.cshtml";
}
<div class="layui-tab layui-tab-brief" lay-filter="user">
    <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 5px 0;">
        <form action="" class="layui-form">
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="text" name="keyWord" placeholder="请输入产品名称搜索" class="layui-input" >
                </div>
            </div>
            <div class="layui-inline">
                <button type="button" class="layui-btn searchButton">搜索</button>
                <a class="layui-btn" href="javascript:ShowPage('/Management/Product/Create','添加产品')">添加产品</a>
            </div>
        </form>
    </div>
    <table class="layui-table" lay-data="{url:'GetData', cellMinWidth: 80, page: true,limit:15}" id="resultList" lay-filter="resultList">
        <thead>
            <tr>
                <th lay-data="{field:'ID', width:80, align:'center'}">ID</th>
                <th lay-data="{ field: 'Name', width:240}">名称</th>
                <th lay-data="{ field: 'No', width:160}">名称</th>
                <th lay-data="{field:'CategoryName', width:160}">类别</th>
                <th lay-data="{field:'Unit', width:80}">单位</th>
                <th lay-data="{field:'ProcessingCost', width:160}">规格型号</th>
                <th lay-data="{field:'Weight', width:80}">重量</th>
                <th lay-data="{field:'AllStock', width:80}">总库存</th>
                <th lay-data="{field:'IsProduction', width:80}">生产件</th>
                <th lay-data="{field:'IsPurchase', width:80}">采购件</th>
                <th lay-data="{width:180,field: 'CreateDateTime'}">添加时间</th>
                <th lay-data="{fixed: 'right', width:120, align:'center', toolbar: '#barDemo'}">操作</th>
            </tr>
        </thead>
    </table>
    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:ShowPage('/Management/Product/Edit?id={{d.ID}}','编辑产品')">编辑</a>
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:DeleteItem({{d.ID}})">删除</a>

    </script>
     
</div>
<script type="text/javascript">
    function DeleteItem(id) {
        layer.confirm('您正在进行删除产品类别操作', {
            btn: ['是的,我要删除该产品类别', '不小心点错了'] //按钮
        }, function () {
            var url = "/Management/Product/Delete?id=" + id;
            $.getJSON(url, function (data) {
                layer.msg(data.Msg);
                if (data.State === 200) {
                    $(".layui-laypage-btn")[0].click();
                }                 
            });
        }, function () {

        });
    }
</script>


